home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 151-175 / scopedisk168 / asmmacros / am_02 / exist.i < prev    next >
Text File  |  1995-03-19  |  1KB  |  42 lines

  1.      NOLIST
  2. Exist       MACRO              ; 19 Dec 88
  3. *------------------------------; Start of Exist macro.
  4.      MOVEQ #-2,D2              ; Make D2 indicate the read accessMode.
  5.      NOLIST
  6.      IFC '\1','I'              ; If <PointerToFileName> is specified, then
  7.      LIST
  8.                                ; Put <PointerToFileName> in D1.
  9.      MOVE.L #\2,D1
  10.      NOLIST
  11.      IFEQ ReEntrant-1
  12.      LIST
  13.      ADD.L A5,D1
  14.      NOLIST
  15.      ENDC
  16.      ENDC
  17.      IFC '\1','D'              ; If <FileName> is specified, then
  18.      LIST
  19.                                ; Make D1 point to <FileName>.str .
  20.      MOVE.L #\2.str,D1
  21.      NOLIST
  22.      IFND \2.str               ; Unless it was previously defined,
  23.      LIST
  24.      SECTION DataSection,DATA  ; The ASCII <FileName> string goes here.
  25. \2.str:
  26.      DC.B '\2',0
  27.      CNOP 0,2
  28.      SECTION CodeSection,CODE
  29.      NOLIST
  30.      ENDC
  31.      ENDC
  32.      LIST
  33.      CallLib Lock,dos          ; Call Lock to get a lock on <FileName>.
  34.      MOVE.L D0,-(A7)           ; Save the lock which indicates existence.
  35.      MOVE.L D0,D1              ; Unlock the file.
  36.      CallLib UnLock,dos
  37.      MOVE.L (A7)+,D0           ; Get the lock back.
  38.      TST.L D0                  ; Make the zero flag indicate existence.
  39. *------------------------------; End of Exist macro.
  40.      ENDM
  41.      LIST
  42.